package bsts.view.transaction;

import java.util.*;
import javax.swing.*;
//import bsts.controller.ComplaintController;
//import bsts.view.complaint.ViewEditComplaintFrm;
import bsts.view.util.GridColumn;
import bsts.view.util.GridControl;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import bsts.controller.*;
//import bsts.model.*;
import bsts.view.util.GridControl;
import bsts.view.util.GridColumn;

/**
 *  @author Francis Louis  A00079985B : 1 April 2011
 *
 */

public class ViewTransactionsFrm extends JFrame implements MouseListener {
	
	private static final long serialVersionUID = 1L;
	//Reusing common grid control
	private	GridControl gridFrm;

	public ViewTransactionsFrm()
	{
		//Create GridColumn
		ArrayList<GridColumn> gridCol = new ArrayList<GridColumn>();
		gridCol.add(new GridColumn("Transaction ID","getTransactionId",50));
		gridCol.add(new GridColumn("Subscription ID","getSubscriptionId",50));
		gridCol.add(new GridColumn("Feature ID","getFeatureId",90));
		gridCol.add(new GridColumn("Number called","getNumber_called",50));
		gridCol.add(new GridColumn("Start Date Time of Call","getStartDateTimeofCall",160));
		gridCol.add(new GridColumn("Duration","getDuration",50));
		
		//Get Complaint List from 
		//ArrayList objList = new ComplaintController().getComplaints();	
		//TransactionController transactionController = new TransactionController();
		//IOController ioController = new IOController();
		//ArrayList<Transaction> transactions = ioController.RetrieveTransactions();	
		//transactionController.getTransactions(subscriptionId, featureid, startDate, endDate)
		gridFrm= new GridControl(600,500,new IOController(),"RetrieveTransactions" ,gridCol,true, this);	
		//add common grid control to customer frame
		add(gridFrm);
		setSize(900,500);
		
	}
	

	/*Public methods Events handler=====================================================================================================*/
	
	public void refreshGrid(){
		this.gridFrm.refreshGrid();
	}
	
//	public void mouseClicked(java.awt.event.MouseEvent e){	
//		//handle double click event
//		if (e.getClickCount() == 2) {
//			 //Points
//			int row=gridFrm.getGrid().rowAtPoint(e.getPoint());		 
//		 	long getTransactionId = Long.parseLong(gridFrm.getGrid().getValueAt(row,0).toString());
//		 	ViewTransactionsFrm frm = new ViewTransactionsFrm(this,getTransactionId,620,470);
//			frm.setVisible(true);		
//		}
//		 
//	 }
	
	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
	
	public static void main(String[] args){
		ViewTransactionsFrm frm = new ViewTransactionsFrm();
		frm.setVisible(true);
	}
}
